<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
	<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
	<title>修改文献</title>
	<link rel="stylesheet" href="css/bootstrap.min.css" />
	<script type="text/javascript" src="js/jquery.js"></script>
	<script type="text/javascript" src="js/bootstrap.min.js"></script>
	<style type="text/css">
		#xuexiao{
			color:#555;
		}
		#xuexiao:hover{
			color:#3a87ad;
		}
	</style>
</head>
<body >
		<%@include file="include/topbar.jsp" %>
		
		<div class="container" style="margin-top: 60px">
			<div class="row">
			<jsp:include page="include/left.jsp" >
				<jsp:param value="wenxianco" name="tag"/>
			</jsp:include>
				
			
			<div class="span9" style="min-height:500px">
				<ul class="breadcrumb" style="border-radius:3px 3px 0 0;margin-bottom:0px;">
        				<li ><h4><i class="icon-file"></i>修改文献</h4></li>
     			</ul>
     			<div class="wall" style="padding:20px 30px;min-height:200px;padding-left:200px">
     			<form action="editwenxian.jspx?wid=${wenxian.id }" method="post" >
     				<div class="control-group">
			            <label  class="control-label">文献编号</label>
			            <div class="controls">
			            <select class="span2" name="qikan" id="qikan">
			            	<option value="empty">----期刊----</option>
			            	<c:forEach items="${qikanlist }" var = "qikan">
			            		<option value="${qikan.id }">${qikan.name }</option>
			            	</c:forEach>
			            </select>
			            <select class="span2" name="time" id="time">
			            	<option value="empty">----出版时间----</option>
			            	<option value="2000">2000</option>
			            	<option value="2001">2001</option>
			            	<option value="2002">2002</option>
			            	<option value="2003">2003</option>
			            	<option value="2004">2004</option>
			            	<option value="2005">2005</option>
			            	<option value="2006">2006</option>
			            	<option value="2007">2007</option>
			            	<option value="2008">2008</option>
			            	<option value="2009">2009</option>
			            	<option value="2010">2010</option>
			            	<option value="2011">2011</option>
			            	<option value="2012">2012</option>
			            	
			            	
			            </select>
			              <input type="text" id="bianhao" name="bianhao" class="input-xlarge" value="${fn:substringAfter(wenxian.id,')') }"/>
			              <span class="help-block">格式为：xx(期号)-xxxx(起始页)-xx(共几页)</span>
			            </div>
          			</div>
          			
          			<div class="control-group">
			            <label  class="control-label">分类</label>
			            <div class="controls">
			              <select name="type" id="fenlei">
			              	<option value="empty">----请选择分类----</option>
			              	
			              </select>
			              
			            </div>
          			</div>
          			
          			<div class="control-group">
			            <label  class="control-label">文献名</label>
			            <div class="controls">
			              <input type="text" id="name" name="name" class="input-xlarge" value="${wenxian.name }"/>
			              
			            </div>
          			</div>
          			
          			<div class="control-group">
			            <label class="control-label">作者</label>
			            <div class="controls">
			              <input type="text" id="author" name="author" class="input-xlarge" value="${wenxian.author }"/>
			              
			            </div>
          			</div>
          			<div class="control-group">
			            <label class="control-label">摘要</label>
			            <div class="controls">
			              <textarea id="zhaiyao" name="zhaiyao" class="input-xlarge"  >
			              ${wenxian.desc }
			              </textarea>
			              
			            </div>
          			</div>
          			
          			<div class="control-group">
			            <label class="control-label">关键字</label>
			            <div class="controls">
			              <input id="keyword" name="keyword" class="input-xlarge" value="${wenxian.keyword }" />
			              
			           
			              
			            </div>
          			</div>
          			
          			
          			
          		
          			<a href="wenxiancontrol.jspx" class="btn btn-inverse" >返回列表</a>
	   				 <a href="javascript:;" class="btn btn-primary" id="queding">确认操作</a>
     				</form>
     			</div>
			</div>	
			
			
			</div>
			</div>
			<%@include file="include/footer.jsp" %>
			
											

			<script type="text/javascript">
				 $(document).ready(function(){
				 $("#queding").click(function(){
				 	if($("#qikan").val() == "empty" || $("#time").val() == "empty" || $("#bianhao").val().trim() == ""  || $("#fenlei").val() == "empty" || $("#author").val().trim() == "" || $("#name").val().trim() == "" || $("#zhaiyao").val() == "" ||$("#keyword").val().trim() == ""){
				 		alert("不能为空！");
				 	}else{
				 		$("form").submit();
				 	}
				 
				 });
				 	
				 
					$("#qikan").change(function(){
						var value = $("#qikan").val();
						
						if(value != "empty"){
							$("#fenlei").text("");
							$("#fenlei").append($("<option>").attr("value","empty").text("----请选择分类----"));
							$.ajax({
								url:"addwenxian.jspx?m=type",
								type:"POST",
								data:{value:value},
								success:function(json){
								
									$(json).each(function(){
										var id = this.id;
										var name = this.name;
										$("#fenlei").append($("<option>").attr("value",id).text(name));
										
									});
								}
							});
						}else {
							alert("分类不能为空！");
						}
					});
				}); 
			</script>
	
</body>
</html>